#pragma once

#include <functional>
#include <string>
#include <chrono>

// 任务优先级
enum class TaskPriority
{
    LOW,
    MEDIUM,
    HIGH,
    CRITICAL
};

// 任务的状态
enum class TaskStatus
{
    WAITING,
    RUNNING,
    COMPLETED,
    FAILED,
    CANCELED
};


// 任务的信息结构

struct TaskInfo
{
    std::function<void()> task;                           // 任务
    TaskPriority priority;                                // 任务的优先级
    std::chrono::steady_clock::time_point submitTime;     // 任务的提交时间
    std::string taskId;                                   // 任务的id
    std::string description;                              // 任务的描述
    TaskStatus status = TaskStatus::WAITING;              // 任务的状态
    std::string errorMessage;                             // 任务的错误信息

    TaskInfo(std::function<void()> task, 
             TaskPriority p = TaskPriority::MEDIUM, 
             std::string id = "", 
             std::string desc = "");
    
    bool operator<(const TaskInfo& othor) const;
};


/******辅助函数******/

// 任务的状态转字符串
std::string taskStatusToString(TaskStatus status);

std::string priorityToString(TaskPriority priority);